require('source-map-support').install({
	environment: 'node'
});

import excelConfig from "./ExcelConfig";

import {ConfigDataContext} from "./generate/entitas";
require("./extension/index")
import {Utils} from "./Utils"
global.context = new ConfigDataContext()
global.utils = Utils
context.initGenerateEntityIndexes()
import "./excel/entityextension/ContextExtension"
import {ExcelParser} from "./excel/ExcelParser";
import {TsGenerator} from "./excel/code_generater/ts/TsGenerator";
import "./excel/valuedecorator"
import * as path from "path";

export class App {
	excel_parse : ExcelParser
	constructor() {
		context.initExtension()
		this.excel_parse = new ExcelParser()
		this.excel_parse.addCodeGenerator(new TsGenerator())
		if (excelConfig.isTest){
			this.excel_parse.addParsePath(path.join( __dirname, "../src/excel/test"))
		}
		else{
			this.excel_parse.addParsePath(excelConfig.configPath)
		}

	}

	parseData(){
		this.excel_parse.parseData(()=>{
			this.excel_parse.exportData()
			this.excel_parse.generateCode()
		})
	}
}

let a =  new App()
a.parseData()